<!doctype html>
<html>
<head>
<script src="js/jquery.js"></script>
<link href="css/css.css" rel="stylesheet" type="text/css">
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0">
<meta name="format-detection" content="telephone=no" />
<title>保洁</title>
<style>
.table{ background-color:#fff; padding-left:4%; padding-right:4%; position:relative; padding-top:10px; padding-bottom:5px;}
.table h3{color:#65646B; padding-bottom:5px;}
.table span{ padding-left:10px;color:#191919}
.table p{ color:#191919;padding-left:81px; padding-bottom:5px;}
/*保洁剂*/
.detergent{ position:fixed; width:100%; height:100%; top:0px; left:0px; z-index:2000; background:#fff;}
.hot_title{height:20px; line-height:20px; color:#65646b; padding-left:14px; box-sizing:border-box; position:relative; font-size:14px; background-color:#f9f9f9;}
.agentia_box{ width:100%; position:relative; float:left}
.agentia{ height:75px; background-color:#fff; position:relative}
.agentia img{ width:26px; height:26px;}
.agentia label{ display:block;width:26px; height:26px;position:absolute; right:5%; top:14px;}
.agentia_img{ width:47px; height:47px; margin-left:4%; background-color:#737cd9; float:left; margin-top:14px;}
.agentia_text{ float:left; margin-left:13px;}
.agentia_text h1{ font-size:14px; line-height:18px; color:#191919; margin-top:11px;}
.agentia_text h2{ font-size:12px; line-height:16px; color:#65646b;}
.agentia_text h3{ font-size:14px; line-height:18px; color:#c40000;}
.reduce,.add{ width:20px; height:20px; position:absolute;right:14px;top:27px;}
.amount{ width:20px; height:20px; position:absolute; right:14px; top:27px; color:#191919; line-height:20px; text-align:center}
/*cart底部购物车*/
.cart_box{ position:absolute; bottom:0; left:0; background-color:#f9f9f9; width:100%;}
.cart_title{ padding-left:4%; line-height:33px; color:#191919; position:relative; background-color:#fff;}
.cart_pro{ height:42px;}
.cart_pro h1{ float:left; line-height:42px; margin-left:4%; color:#191919;}
.cart_pro h2{ float:left; line-height:42px; margin-left:20%; color:#c40000; }
.cart_pro img{ float:right; width:20px; height:auto; margin-top:11px;}
.cart_pro p{ float:right; width:25px; height:20px; margin-top:11px; color:#191919; text-align:center}
.cart{ height:47px; position:relative; margin-top:16px; background-color:#fff;}
.cart img{ width:46px; height:46px; position:absolute; left:4%; bottom:17px;}
.sure{ float:right; width:25%; height:47px; background-color:#FF7F00; color:white; line-height:47px; text-align:center; font-size:18px;}
.cart p{ color:#c40000; font-size:18px; line-height:47px; float:right; margin-right:6px;}
.cart h1{ color:#191919; font-size:14px; line-height:47px; float:right}
.number{ position:absolute; left:4%; top:-15px; margin-left:34px; height:18px; width:18px; background-color:#c40000; border-radius:50%; line-height:18px; text-align:center; color:white; font-size:12px;}
</style>
</head>
<?php $id=$_GET;?>
<body style="background-color: #f9f9f9;">
<!--header顶部标题-->
<div class="header">确认订单
	<div class="header_left" onclick="window.history.go(-1)"><img src="images/return.png"></div>
</div>
<!--column服务地址-->
<div class="table" >
	<div class="address">
	<div class="border_top"></div>
    	<h3>服务内容：<span>{{$userss->name1}}</span></h3>
        <h3 style=" position:absolute">服务地址：{{$kkll->site_id}}&nbsp;{{$kkll->site}}</h3><p><p><p>
        <p style="">{{$kkll->username}}&nbsp;{{$kkll->tel}}&nbsp;</p>

        <?php if(!empty($kkoo)){?>
        @foreach($kkoo as $v)
        <h3>{{$v['id']}}：<span>{{$v['zhi']}}</span></h3>
        @endforeach
        <?php }?>
        <h3>服务时间：<span>{{$users->xiadan_titme}}</span></h3>



    <div class="border_bottom"></div>
</div>
</div>

<!--column推荐保洁剂-->
<div class="column_box box" style="margin-top:14px;">
	<div class="border_top"></div>
	<div class="column_img"><img src="images/cleaning.png"></div>
    <p>推荐保洁剂</p>
    <div class="border_bottom" style=" width:92%; left:4%"></div>
</div>
<!--agentia保洁剂-->
<div class="agentia_box">
    <?php $bb=0;?>
@foreach($shanp as $v)
    <div class="agentia">
    <div><img  class="agentia_img" src="{{$v->tup}}" onclick="document.location='WeiMeng?id={{$v->id}}';"></div>
    	<!-- <div class="agentia_img" ></div> -->
        <div class="agentia_text">
            <h1>{{$v->name}}</h1>
            <h2>月售：{{$v->xiaol}}</h2>
            <h3>￥<span lhf=<?php echo $bb?>>{{$v->jiage}}</span></h3>
        </div>
        <label for="check_1" class="lab">
        	<img  class="checked" lhf=<?php echo $bb?> src="images/check.jpg"  onclick="info(<?php echo $bb;?>)">
            <input type="checkbox" id="" lhf=<?php echo $bb?> style="display:none">
        </label>
        <div class="border_bottom" style=" width:92%; left:4%"></div>
    </div>
    <?php $bb++;?>
@endforeach
</div>
<!--底部购物车-->

<div class="cart_box">
    <div class="cart">
        <div class="border_top"></div>
        <div class="sure"  onclick="tjia(<?php echo $users->id?>)">选好了</div>
        <p id="total">￥<span class='ssk'>{{$jiaq->xiadan_money}}</span></p>
        <h1>合计：</h1>
    </div>
</div>
</div>
<script>
    var p=20;
    var ssk=[];
    var qian=[];
	xiadan_money='';
    zongjia = $(".ssk").text();
     function info(jie){
         ssk[jie] = $("img[lhf="+jie+"]").attr('src');
        if(ssk[jie] == 'images/check.jpg'){
            qian[jie] = $("span[lhf="+jie+"]").text();
            // ssk[jie] = true;
        }else{
            qian[jie] = 0;
        }
        var sum =0;
        for(var i=0;i<qian.length;i++){
            if(qian[i]==undefined || qian[i]==null){
                qian[i]=0;
            }

            sum=sum+parseInt(qian[i]);

        }
        if(sum!=0){
            xiadan_money = sum+parseInt(zongjia);
        }else{
            xiadan_money = parseInt(zongjia);
        }
        $('.ssk').text(xiadan_money);

     }


var i=[];
$(".checked").click(function(){
            ze = $(this).attr('lhf');
            if(i[ze] == undefined){
                i[ze]=0;
            }
        // console.log(i);
                if(i[ze]==0){
                    $(".checked[lhf="+ze+"]").attr("src","images/checked.jpg");i[ze]=1;
                }else{
                    $(".checked[lhf="+ze+"]").attr("src","images/check.jpg");i[ze]=0;
                }
	})

    function tjia(id){
        var xiadan_money = $('.ssk').text();
        var id=id;
		$.ajax({
        url:'sheet',
        data:{xiadan_money,id},
        success:function(res){
			if(res.code==0){
				alert(res.msg);
                location.href = 'recharge';
			}else if(res.code==1){
				alert(res.msg);
                location.href = 'myorder';
			}
		}});
	}
</script>
</body>
</html>
